/* 定义默认主题
需要Chromium 111+才支持color-mix函数，
当前electron对应的版本是91不支持 color-mix
浏览器可以手动获取color-mix的具体颜色，因此手动替换
更改主题色时，放开，手动记录后，注释掉
*/
:root {
    /* 定义主题主色 */
    --primary-color: #005bdb; /* 新增主题主色 */

    --bg-color: color-mix(in srgb, var(--primary-color) 0.1%, #fff);
    --text-color: color-mix(in srgb, var(--primary-color) 15%, #333);

    --scrollbar-color: color-mix(in srgb, var(--primary-color) 3%, #F5F5F5);
    --scrollbar-bg-color: color-mix(in srgb, var(--primary-color) 15%, rgba(0,0,0,0.3));

    --item-bg-color: color-mix(in srgb, var(--primary-color) 10%, #efefef);
    --item-text-color: color-mix(in srgb, var(--primary-color) 5%, #333);
    --item-border-color: color-mix(in srgb, var(--primary-color) 20%, #666);

    --item-bg-color-hover: color-mix(in srgb, var(--primary-color) 60%, #333);
    --item-text-color-hover: color-mix(in srgb, var(--primary-color) 5%, #efefef);
    --item-border-color-hover: color-mix(in srgb, var(--primary-color) 50%, #aaa);

    --item-border-color-hover20: color-mix(in srgb, var(--item-border-color-hover) 20%, transparent);
    --item-bg-color-hover70: color-mix(in srgb, var(--item-bg-color-hover) 70%,transparent);
}

:root {
    --primary-color: #005bdb;
    --bg-color: #ffffff;
    --text-color: #2b394c;
    --scrollbar-color: #f0f4f9;
    --scrollbar-bg-color: rgba(13, 35, 75, 0.25);
    --item-bg-color: #e6eeff;
    --item-text-color: #555555;
    --item-border-color: #5271bd;
    --item-bg-color-hover: #144b98;
    --item-text-color-hover: #efefef;
    --item-border-color-hover: #5583c3;

    --item-border-color-hover20: rgba(85, 131, 195, 0.2);
    --item-bg-color-hover70: rgba(20, 75, 152, 0.7);
}

/* 其他所有代码保持不变 */
div::-webkit-scrollbar {
    width: clamp(5px, 0.3vw, 10px);
    height: clamp(5px, 0.3vw, 10px);
    background-color: var(--bg-color);
}

div::-webkit-scrollbar-thumb{
    background-color: var(--scrollbar-bg-color);
    border-radius: clamp(10px, 0.3vw, 15px);
}

div::-webkit-scrollbar-track{
    -webkit-box-shadow: inset 0 0 6px var(--scrollbar-bg-color);
    background-color: var(--scrollbar-color);
    border-radius: clamp(10px, 0.3vw, 15px);
}

html {
    font-size: clamp(12px, 1.5vw, 32px);
}

body {
    font-size: 1rem;
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
}

.menus{
    width: 100%;
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.menus-item{
    width: 80%;
    margin: 2% 0;
    color: var(--item-text-color);
    background-color: var(--item-bg-color);
    border-radius: clamp(5px, 0.5vw, 15px);
    padding: clamp(5px, 0.4vw, 10px) clamp(10px, 1vw, 80px);
    text-align: center;
    line-height: 1.5;
    transition: all 0.3s ease;
    cursor: pointer;
}

.menus-item:hover{
    color: var(--item-text-color-hover);
    background-color: var(--item-bg-color-hover);
}

.menus-item-active{
    color: var(--item-text-color-hover);
    background-color: var(--item-bg-color-hover);
}

.button{
    color: var(--item-text-color);
    background-color: var(--item-bg-color);

    border-radius: clamp(5px, 0.75vw, 15px);
    text-align: center;
    cursor: pointer;
    display: inline-block;
    padding: clamp(5px, 0.45vw, 8px) clamp(10px, 1.35vw, 25px);
    font-size: 0.8rem;
    line-height: 1.5;
    border: clamp(1px, 0.15vw, 2px) solid var(--item-border-color);
    transition: all 0.3s ease;
}

.button:hover{
    color: var(--item-text-color-hover);
    background-color: var(--item-bg-color-hover);
    border-color: var(--item-bg-color-hover);
}

.button-small{
    color: var(--item-text-color);
    background-color: var(--item-bg-color);
    border-radius: clamp(5px, 0.55vw, 15px);
    text-align: center;
    cursor: pointer;
    display: inline-block;
    padding: clamp(3px, 0.25vw, 4px) clamp(5px, 1.2vw, 20px);
    font-size: 0.6rem;
    line-height: 1.5;
    border: clamp(0px, 0.15vw, 1px) solid var(--item-border-color);
    transition: all 0.3s ease;
}

.button-small:hover{
    color: var(--item-text-color-hover);
    background-color: var(--item-bg-color-hover);
    border-color: var(--item-bg-color-hover);
}

.label {
    min-height: clamp(10px, 1.35vw, 25px);
    display: block;
    font-weight: 600;
    color: var(--item-text-color);
    font-size: 0.75rem;
}

.select {
    width: 100%;

    box-sizing: border-box;
    padding: clamp(5px, 0.45vw, 8px) clamp(10px, 1.35vw, 25px);

    border: clamp(1px, 0.15vw, 2px) solid var(--item-border-color);
    border-radius: clamp(5px, 0.75vw, 15px);

    background: var(--bg-color);
    color: var(--text-color);
    font-size: 0.8rem;
    line-height: 1.5;

    transition: all 0.3s ease;

    background-image: url("../img/select.png");
    background-repeat: no-repeat;
    background-position: right clamp(5px, 1vw, 15px) center;
    background-size: clamp(10px, 1vw, 15px);
    cursor: pointer;
}

.select:focus {
    outline: none;
    border-color: var(--item-border-color-hover);
    box-shadow: 0 0 0 clamp(3px, 0.5vw, 5px) var(--item-border-color-hover20);
}

.select:hover {
    border-color: var(--item-border-color-hover);
}

.options {
    position: absolute;
    top: calc(100% + clamp(5px, 0.75vw, 10px));
    left: 0;

    width: 100%;
    max-height: clamp(120px, 20vw, 200px);
    overflow-y: auto;

    border: clamp(1px, 0.15vw, 2px) solid var(--item-border-color-hover);
    border-radius: clamp(3px, 0.5vw, 5px);
    background-color: var(--bg-color);

    z-index: 1000;
}

.option{
    box-sizing: border-box;
    padding: clamp(5px, 0.45vw, 8px) clamp(10px, 1.35vw, 25px);

    color: var(--text-color);
    font-size: 0.8rem;
    line-height: 1.5;
}

.option:hover {
    color: var(--item-text-color-hover);
    background-color: var(--item-bg-color-hover70);
}

.option-active {
    font-weight: 600;
    color: var(--item-border-color-hover);
}

.form {
    width: 100%;
}

.form-group{
    margin-bottom: clamp(5px, 1vw, 15px);
}

.form-button{
    display: flex;
    justify-content: flex-end;
    gap: clamp(5px, 1.2vw, 20px);
    padding: clamp(5px, 0.4vw, 10px) clamp(10px, 2.5vw, 80px);
}


.form-item{
    width: 80%;
    position: relative;
}

.form-row{
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: clamp(5px, 0.5vw, 10px);
    justify-content: flex-end;
}

.required {
    color: #e74c3c;
}

.input {
    width: 100%;

    box-sizing: border-box;
    padding: clamp(5px, 0.45vw, 8px) clamp(10px, 1.35vw, 25px);

    border: clamp(1px, 0.15vw, 2px) solid var(--item-border-color);
    border-radius: clamp(5px, 0.75vw, 15px);

    background: var(--bg-color);
    color: var(--text-color);
    font-size: 0.8rem;
    line-height: 1.5;

    transition: all 0.3s ease;

}

.input:focus {
    outline: none;
    border-color: var(--item-border-color-hover);
    box-shadow: 0 0 0 clamp(3px, 0.5vw, 5px) var(--item-border-color-hover20);
}

.input:hover {
    border-color: var(--item-border-color-hover);
}

.file {
    width: 100%;

    box-sizing: border-box;
    padding: clamp(5px, 0.45vw, 8px) clamp(10px, 1.35vw, 25px);

    border: clamp(1px, 0.15vw, 2px) solid var(--item-border-color);
    border-radius: clamp(5px, 0.75vw, 15px);

    background: var(--bg-color);
    color: var(--text-color);
    font-size: 0.8rem;
    line-height: 1.5;

    transition: all 0.3s ease;

}

.file:focus {
    outline: none;
    border-color: var(--item-border-color-hover);
    box-shadow: 0 0 0 clamp(3px, 0.5vw, 5px) var(--item-border-color-hover20);
}

.file:hover {
    border-color: var(--item-border-color-hover);
}

.file-button{
    position: absolute;
    width: max-content;
    transform: translate(-100%, 0);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.rule{
    width: 100%;
    height: 100%;

    display: flex;
}

.rule-blockly{
    width: 60%;
    height: 100%;
}

.rule-blockly-div{
    width: 100%;
    height: 100%;
}

.rule-editor{
    width: 40%;
    height: 100%;

    position: relative;
}

.rule-editor-icons{
    width: 100%;

    position: absolute;
    z-index: 2;

    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: clamp(2px, 0.3vw, 5px);

    box-sizing: border-box;
    padding: clamp(2px, 0.3vw, 5px);
}

.rule-editor-div{
    width: 100%;
    height: 100%;
}

.CodeMirror-hints li{
    font-size: 0.4rem;
}

.msg-box {
    position: fixed;
    top: 5%;
    left: 50%;
    z-index: 9999;

    padding: clamp(5px, 0.45vw, 8px) clamp(10px, 1.35vw, 25px);
    border-radius: clamp(3px, 0.5vw, 5px);

    min-width: 10%;
    max-width: 40%;

    opacity: 0;
    transform: translateX(-50%) translateY(clamp(-30px, -3vh, -20px));

    transition: all 0.3s ease; /* 控制淡出动画 */
}

.fade-out{
    opacity: 0;
    transform: translateX(-50%) translateY(clamp(-30px, -3vh, -20px));
}

.fade-in{
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* 内容样式 */
.msg-content {
    flex: 1;
    font-size: 0.6rem;
    color: #333;
    line-height: 1.5;
}

/* 类型样式 */
.message-success {
    border-color: #e1f3d8;
    background-color: #f0f9eb;
}

.message-warn {
    border-color: #faecd8;
    background-color: #fffbe6;
}

.message-info {
    border-color: #e6f7ff;
    background-color: #f0f9ff;
}

.message-error {
    border-color: #fde2e2;
    background-color: #fff2f2;
}

.icon{
    color: var(--item-text-color);
    background-color: var(--item-bg-color);

    border-radius: 20%;
    text-align: center;
    cursor: pointer;
    display: inline-block;
    padding: clamp(5px, 0.45vw, 8px) clamp(10px, 1.35vw, 25px);
    font-size: 0.8rem;
    line-height: 1.5;
    border: clamp(1px, 0.15vw, 2px) solid var(--item-border-color);
    transition: all 0.3s ease;
}

.icon:hover{
    color: var(--item-text-color-hover);
    background-color: var(--item-bg-color-hover);
    border-color: var(--item-bg-color-hover);
}

.icon-small{
    color: var(--item-text-color);
    background-color: var(--item-bg-color);
    border-radius: 20%;
    text-align: center;
    cursor: pointer;
    display: inline-block;
    padding: clamp(3px, 0.25vw, 4px) clamp(5px, 1.2vw, 15px);
    font-size: 0.6rem;
    line-height: 1.5;
    border: clamp(0px, 0.15vw, 1px) solid var(--item-border-color);
    transition: all 0.3s ease;
}

.icon-small:hover{
    color: var(--item-text-color-hover);
    background-color: var(--item-bg-color-hover);
    border-color: var(--item-bg-color-hover);
}